﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;

using Microsoft.Scripting.Utils;
using System.Reflection.Emit;
using Microsoft.Scripting.Ast;
using Scala.Compiler.Ast;

namespace Scala.Compiler.Binding
{
    public class ScalaVariable
    {
        private readonly string _name;
        private string _typeName;
        private readonly ScalaScope _scope;
        private bool _accessedInNestedScope;
        private int _index;
        private Tree _ast;

        public ScalaVariable(string name, ScalaScope scope, Tree ast)
        {
            Assert.NotNull(scope);
            _name = name;
            _scope = scope;
            _ast = ast;
        }

        public string Name { get { return _name; } }
        public bool IsProperty { get; set; }
        public bool IsParam { get; set; }
        public PropertyBuilder PropertyBuilder { get; set; }
        public ParameterExpression ParamExpression { get; set; }
        public Tree Ast { get { return _ast; } }
        public Scala.Compiler.Ast.Expression DefaultValue { get; set; } 
        public string TypeName { get { return _typeName; } set { _typeName = value; } }
        public ScalaScope Scope { get { return _scope; } }
        internal int Index { get { return _index; } set { _index = value; } }
        public bool AccessedInNestedScope { get { return _accessedInNestedScope; } set { _accessedInNestedScope = value; } }
    }
}
